<?php
class FocusProgram extends AppModel {
	var $name = 'FocusProgram';
	var $displayField = 'id';
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'Program' => array(
			'className' => 'Program',
			'foreignKey' => 'program_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'FocusArea' => array(
			'className' => 'FocusArea',
			'foreignKey' => 'focus_area_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
        var $validate = array(		
		'focus_area_id' => array(                    
			'multiple' => array(
				'rule' => array('multiple', array('in' => array('2', '3', '4', '5', '6', '7', '8'), 'min' => 1, 'max' => 3)),
                                'required' => true,
				'message' => 'You have to select at least one but not more than three focus areas.',
				'allowEmpty' => false,				
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			)
                    )
	);
}
